// created by noellynch
// May 14, 2011

package com.gruntdb.core;

import java.util.Hashtable;

import com.gruntdb.core.stubs.IStorageEngine;
import com.gruntdb.engines.indexedjson.IndexedJSONStorageEngine;

public class GruntDB {
	private		Hashtable<String, GruntDataStore>		mcla_dataStores;
	
	static	private		Class<? extends IStorageEngine>		STORAGE_ENGINE_CLASS = IndexedJSONStorageEngine.class;
	
	public	GruntDB() {
		mcla_dataStores = new Hashtable<String, GruntDataStore>();
	}
	
	public	GruntDataStore		getDataStore(String str_name, String str_location, Class cl_valueClass) {
		GruntDataStore		lcl_ds = mcla_dataStores.get(str_name);
		
		if(lcl_ds == null) {
			// create new
			lcl_ds = new GruntDataStore(str_name, str_location, cl_valueClass, STORAGE_ENGINE_CLASS);
		}
		
		return lcl_ds;
		
	}
}
